home *** CD-ROM | disk | FTP | other *** search
/ Know Your Hockey - The Greatest Player Resource / Know Your Hockey: The Greatest Player Resource.iso / hockey / director / ktgcst.cst / 00097_Script_ButtonsObject < prev    next >
Text File  |  1998-09-28  |  2KB  |  90 lines

  1. property LastSelected,NowOn
  2.  
  3. on new me,which
  4.   set NowOn = []
  5.   set lastSelected = []
  6.   return me
  7. end
  8.  
  9. --which = sprite channel
  10. -- type-- annimation behavoiur 
  11. --1 no mousedown screen state
  12. --2 mousedown screen state
  13. -- action -- handler name or go to X
  14. -- clickit = puppetsound that you wantplayed for button click
  15.  
  16. global gButtonState
  17.  
  18. on button me, which,type,action,Clickit
  19.   put mousecast() into MB
  20.   if voidp(Clickit) = 0 then
  21.     puppetsound 0
  22.     puppetsound Clickit
  23.     updatestage
  24.   end if  
  25.   puppetsprite which,1  
  26.   -- behave according to type required
  27.   case type of
  28.       
  29.     1:  -- non sticky button does action on mousedown
  30.       losepop(window "pop")
  31.       repeat while stilldown()=1
  32.         if mousecast()= MB then
  33.           set the membernum of sprite which to MB+1
  34.           set the blend of sprite which = 100
  35.           updatestage
  36.           next repeat
  37.         end if
  38.         --return to normal whem off button
  39.         if (mousecast() <>MB+1)then 
  40.           set the membernum of sprite which to MB
  41.           set the blend of sprite which = 0
  42.         end if
  43.         updatestage
  44.         if rollOver(which) then
  45.           do action
  46.         end if
  47.       end repeat
  48.       set the membernum of sprite which to MB 
  49.     2:  
  50.       -- threestate button that sticks on
  51.       set clicked = getat(gbuttonstate,which)
  52.       if clicked = 0 and mousecast() = MB then 
  53.         repeat while stilldown()=1  
  54.           if mousecast()= MB then 
  55.             set the membernum of sprite which = MB+1
  56.             set the blend of sprite which = 100
  57.             updatestage
  58.           end if
  59.           --return to normal whem off button
  60.           if (mousecast() <>MB+1)then  
  61.             set the member of sprite which to MB
  62.             set the blend of sprite which = 0
  63.             updatestage
  64.           end if 
  65.         end repeat
  66.       else
  67.         puppetsound 0
  68.         losepop(window "pop")
  69.         setat(gbuttonstate,clickon(),0)
  70.         set the membernum of sprite which = MB-1
  71.         updatestage
  72.         exit
  73.       end if
  74.       if rollOver(which) then
  75.         puppetsound 0
  76.         set the membernum of sprite which = MB+1
  77.         setat(gbuttonstate,which,2)
  78.         updatestage
  79.         do action
  80.       end if
  81.   end case
  82. end
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.